package com.xyht.sca_s.student_manage_system.modules.waterMark.config;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.xyht.sca_s.student_manage_system.modules.waterMark.entity.SmsWaterMarkRecord;
import com.xyht.sca_s.student_manage_system.modules.waterMark.mapper.SmsWaterMarkRecordMapper;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

import static com.xyht.sca_s.student_manage_system.modules.waterMark.constant.RecordStatusConstant.RECORD_STATUS_DOING;
import static com.xyht.sca_s.student_manage_system.modules.waterMark.constant.RecordStatusConstant.RECORD_STATUS_ERR;

@Component
public class WaterMarkConfig {
    @Resource
    private SmsWaterMarkRecordMapper smsWaterMarkRecordMapper;

    @Bean
    public void waterMarkInit(){
        //水印进程初始化，将进行中置为异常
        SmsWaterMarkRecord updateRecord = new SmsWaterMarkRecord();
        updateRecord.setRecordStatus(RECORD_STATUS_ERR);
        smsWaterMarkRecordMapper.update(updateRecord,new LambdaQueryWrapper<SmsWaterMarkRecord>()
                .eq(SmsWaterMarkRecord::getRecordStatus,RECORD_STATUS_DOING));
    }

}
